{% extends "real_estate_app/base.html" %}

{% block head %}
<script src="{{ ADMIN_MEDIA_PREFIX }}js/jquery.min.js" type="text/javascript"></script>
<script src="{{ ADMIN_MEDIA_PREFIX }}js/jquery.init.js" type="text/javascript"></script>
<script src="{{ MEDIA_REAL_ESTATE }}js/fullcalendar/fullcalendar.min.js"></script>
<link rel="stylesheet" href="{{ MEDIA_REAL_ESTATE }}js/fullcalendar/fullcalendar.css" />
<link media="print" rel="stylesheet" href="{{ MEDIA_REAL_ESTATE }}js/fullcalendar/fullcalendar.print.css" />

<script type="text/javascript">
	(function($) {
		$(document).ready(function() {
			
			$('#calendar').fullCalendar({
				header: {
					left: 'prev,next today',
					center: 'title',
					right: 'month,agendaWeek,agendaDay'
				},
				
				events: function(start, end, callback) {
					$.ajax({
            				url: '/imoveis/calendar/json/',
            				dataType: 'json',
            				success: function(doc) {
            					var events = [];
            					$(doc).each(function(){
            						events.push({
            							title:$(this).attr('title'),
            							start:Date($(this).attr('start')),
            						});

            					})
            					callback(events);
            				}
			        });
				}
			});
		})
	})(django.jQuery);
</script>
{% endblock %}


{% block content_main %}
	<div id="calendar" style="width:500px;"></div>
{% endblock %}